package org.ehe.erp.domain.quality.dto;

import lombok.Data;

import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;

/**
 * 批次追溯响应对象
 *
 * @author zhangnn
 * @className BatchTraceabilityResponse
 * @description 批次追溯查询结果，包含批次的所有质检记录和问题反馈
 * @date 2025-09-10 15:00:00
 */
@Data
public class BatchTraceabilityResponse implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    /** 批次基本信息 */
    private BatchInfo batchInfo;

    /** 该批次参与的质检任务列表 */
    private List<QualityTaskSummary> qualityTasks;

    /** 该批次相关的质检问题列表 */
    private List<QualityIssueSummary> qualityIssues;

    /**
     * 批次信息内部类
     */
    @Data
    public static class BatchInfo implements Serializable {

        @Serial
        private static final long serialVersionUID = 1L;

        private Long batchId;
        private String batchNo;
        private Long materialId;
        private String materialName;
        private String materialCode;
        private Long supplierId;
        private String supplierName;
        private LocalDate productionDate;
        private LocalDate expiryDate;
    }

    /**
     * 质检任务摘要内部类
     */
    @Data
    public static class QualityTaskSummary implements Serializable {

        @Serial
        private static final long serialVersionUID = 1L;

        private Long taskId;
        private String taskNo;
        private String productName;
        private Integer taskStatus;
        private LocalDateTime createTime;
        private LocalDateTime completeTime;
        private Integer totalItems;
        private Integer passedItems;
        private Integer failedItems;
    }

    /**
     * 质检问题摘要内部类
     */
    @Data
    public static class QualityIssueSummary implements Serializable {

        @Serial
        private static final long serialVersionUID = 1L;

        private Long feedbackId;
        private String feedbackNo;
        private String problemDesc;
        private Integer severityLevel;
        private Integer status;
        private LocalDateTime feedbackTime;
        private String feedbackPerson;
    }
}

